package com.web.manager.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.web.manager.mapper.NoticeMapper;
import com.web.manager.pojo.Notice;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class NoticeService extends ServiceImpl<NoticeMapper, Notice> {

    @Resource
    private NoticeMapper noticeMapper;

    @Override
    public boolean save(Notice entity){

        return super.save(entity);
    }


    public Notice selectByUsername(String title){
        QueryWrapper<Notice> queryWrapper = new QueryWrapper<>(); //条件查询器
        queryWrapper.eq("title",title);  // ==> where username = #{username}


        // 根据用户名查询数据库的用户信息
        return  this.getOne(queryWrapper); // ==>select * from manager_user where username = #{username}
    }


}
